/*
 * Reports.h
 *
 *  Created on: Oct 19, 2011
 *      Author: kimi
 */

#ifndef REPORTS_H_
#define REPORTS_H_

#include <string>
#include <fstream>
#include <iostream>

#include "../DataStructures/Voting/CountingMgr.h"
#include "../DataStructures/BTree/BTree.h"
#include "../Model/Distrito.h"
#include "../Model/Lista.h"
#include "../Model/Cargo.h"
#include "../Configuration/Properties.h"
#include "../Crypto/Vigenere.h"

using namespace std;

class Reports {
public:
	Reports(Properties * _props);
	virtual ~Reports();

	/*
	 * Devuelve true si se pudo crear el reporte
	 */
	bool createReportForEleccion(unsigned long idEleccion, string filePath, Properties * props);
	bool createReportForLista(string nombreLista, string filePath, Properties * props);
	bool createReportForDistrito(unsigned long idDistrito, string filePath, Properties * props);
	
private:
	unsigned long contarVotos(vector<Count> datos);
	vector<int> contarVotosDistrito(vector<Count> datos);
	unsigned long contarVotosLista(vector<unsigned long> datos, CountingMgr* cMgr);
	unsigned long contarVotosEleccion(vector<unsigned long> vectorVotos);
	unsigned long getListaGanadora(vector<unsigned long> vectorVotosLista, vector<unsigned long> listas);
	
	bool encriptarArchivo(string filePath);
	bool desencriptarArchivo(string filePath);

	Properties* props;
};

#endif /* REPORTS_H_ */
